﻿/***********************************************************
! @File        : helloword.h
 *  @Brief       : 插件通信示例
 *  @Details     : 插件通信示例
 *  @Author      : soda
 *  @Date        : 2023-04-28 16:38:37
 *  @Version     : v1.0
 *  @Copyright   : Copyright By soda, All Rights Reserved
 ***********************************************************/
#pragma once
#include <service/event/ctkEventHandler.h>
#include <service/event/ctkEventAdmin.h>
#include <service/event/ctkEventConstants.h>
#include <QQuickView>
#include <hellomanager.h>

class HelloWord : public HellowordHandleMessage, public ctkEventHandler
{
    Q_OBJECT
    Q_INTERFACES(ctkEventHandler)
public:
    explicit HelloWord(ctkPluginContext *context, QObject *parent = nullptr);
    ~HelloWord();

    void TestInterface();
    QString doGetSTringFromHelloword();
    void postCtkEvent(const QString event, const QVariant data = QVariant(), const QVariant extentionData = QVariant());

protected:
	ctkEventAdmin* getEventAdmin();
    void handleEvent(const ctkEvent& event);
    void startListening();

public slots:
    void onCtkEvent(const ctkEvent& event);

signals:
    void handleCtkEvent(const ctkEvent& event);

private:
    void initQmlWindow();
    void loadQmlWindowStatus();

    ctkPluginContext *m_context = nullptr;
    HelloManager* m_helloManager = nullptr;
    QQmlComponent *m_component = nullptr;
    QObject* m_selfObject = nullptr;
};
